﻿using System;
using SmartDeviceProject1.Data.MobileWalletDBDataSetTableAdapters;
using SmartDeviceProject1.Forms;
namespace SmartDeviceProject1.Data.MobileWalletDBDataSetTableAdapters
{
    partial class PayCategoryTableAdapter
    {
        public void AlertQuery(CategoryType ct)
        {
            CommandCollection[0].CommandText =
                string.Format("SELECT   CategoryId, CategoryTitle, CategoryDetail, CategoryType\r\nFROM      PayCategory\r\nWHERE   (CategoryType = {0})",
                (byte)ct);
        }
    }
}
namespace SmartDeviceProject1.Data
{
    class DBHelper
    {
        PayCategoryTableAdapter payCategoryTableAdapter = new PayCategoryTableAdapter();
        public void InsertCategory(string title, CategoryType type, string detail)
        {
            payCategoryTableAdapter.Insert(Guid.NewGuid(), title, detail, (byte) type);
        }
        public void DeleteCategory(Guid id)
        {
            payCategoryTableAdapter.Delete(id);
        }
        public void ChangeCategoryTitle(Guid id, string newTitle, CategoryType type)
        {
            payCategoryTableAdapter.Update(id, newTitle, "", (byte) type, id);
        }
        public void InsertPayDetail(string paydesc, string paymemo, decimal amount, DateTime date, Guid typeId)
        {
            PayDetailTableAdapter payDetailTableAdapter = new PayDetailTableAdapter();
            payDetailTableAdapter.Insert(Guid.NewGuid(), paydesc, paymemo, date, amount,typeId);
        }
    }
}
